


namespace Nadine
{


	//------------------------------------------------------------
	class NDMFVCTest : public NDBaseObject
	{
	private:
		NDUID							m_nCaptureID;
		UINT							m_nTextureID;
		NDUID							m_nTexID;

		NDUID							m_nUSBCameraFPS;

		UINT							m_nUSBCameraFPSCt;
		float							m_fUSBCameraFPSCt;

		BYTE*							m_pBuffer;
		NDW32ReadWriteLocker			m_rwl;
		bool							m_bNeedsReload;

		//artoolkit	
		int								patt_id;
		double							gl_para[16];
		ARParam							wparam;
		GLdouble						p[16];
		bool							bFoundMark;

		bool							bEnterRendering;

		//MD3 Model
		//CModelMD3*						m_myEntity;			//md3 model


	protected:
		void			argConvGlpara(double para[3][4], double gl_para[16]);
		static double	norm(double a, double b, double c);
		static double	dot(double a1, double a2, double a3, double b1, double b2, double b3);
		int				arParamDecompMat(double source[3][4], double cpara[3][4], double trans[3][4]);
		void			arglCameraFrustumRH(ARParam* cparam, double const focalmin, double const focalmax, GLdouble m_projection[16]);
		void			arglCameraViewRH(double para[3][4], GLdouble m_modelview[16], double const scale);

	public:
		explicit NDMFVCTest( NDArk* pArk ) :NDBaseObject(99)
		{
			this->setArk(pArk);
			bEnterRendering =false;
			//this->m_pStrModuleName ="NDMFVCTest";
		}

		virtual ~NDMFVCTest()	{}

		//common func.
		bool initialize();

		virtual void release();

		//cb func.
		virtual bool beginRender(float fElapsedTime); //
		virtual void endRender();

		virtual void renderUI(float fElapsedTime);
		virtual void frameMove(float fElapsedTime);

		void captureCBFunc(NDUID nCaptureID, BYTE const*pBuffer, UINT nWidth, UINT nHeight);
		static void CALLBACK CBFUNC(NDUID nCaptureID, BYTE const*pBuffer, UINT nWidth, UINT nHeight);

	};
}